package com.gouqi.tools.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gouqi.tools.model.dto.usertool.UserToolQueryRequest;
import com.gouqi.gouqitoolscommon.model.entity.UserTool;
import com.gouqi.tools.model.vo.UserToolVO;

import javax.servlet.http.HttpServletRequest;

/**
 * @description 针对表【user_tool(用户调用工具关系)】的数据库操作Service
 */
public interface UserToolService extends IService<UserTool> {
    /**
     * 校验
     *
     * @param userTool
     * @param add
     */
    void validUserTool(UserTool userTool, boolean add);

    /**
     * 获取查询条件
     *
     * @param userToolQueryRequest
     * @return
     */
    QueryWrapper<UserTool> getQueryWrapper(UserToolQueryRequest userToolQueryRequest);

    /**
     * 获取用户调用工具关系封装
     *
     * @param userTool
     * @param request
     * @return
     */
    UserToolVO getUserToolVO(UserTool userTool, HttpServletRequest request);

    /**
     * 分页获取用户调用工具关系封装
     *
     * @param userToolPage
     * @param request
     * @return
     */
    Page<UserToolVO> getUserToolVOPage(Page<UserTool> userToolPage, HttpServletRequest request);

    /**
     * 调用工具统计
     *
     * @param userToolId
     * @param userId
     * @return
     */
    boolean invokeCount(String userToolId, String userId);
}
